import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '外部采购信息id',
    align:"center",
    dataIndex: 'infoId'
   },
   {
    title: '公告标题',
    align:"center",
    dataIndex: 'title'
   },
   {
    title: '公告类型',
    align:"center",
    dataIndex: 'type'
   },
   {
    title: '区域',
    align:"center",
    dataIndex: 'region'
   },
   {
    title: '采购人',
    align:"center",
    dataIndex: 'purchaser'
   },
   {
    title: '发布时间',
    align:"center",
    dataIndex: 'publishTime'
   },
   {
    title: '发布机构',
    align:"center",
    dataIndex: 'publishOrgin'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '外部采购信息id',
    field: 'infoId',
    component: 'InputNumber',
  },
  {
    label: '公告标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '公告类型',
    field: 'type',
    component: 'Input',
  },
  {
    label: '区域',
    field: 'region',
    component: 'Input',
  },
  {
    label: '采购人',
    field: 'purchaser',
    component: 'Input',
  },
  {
    label: '发布时间',
    field: 'publishTime',
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '发布机构',
    field: 'publishOrgin',
    component: 'Input',
  },
  {
    label: '公告内容',
    field: 'content',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const bidProclamationAttachmentColumns: JVxeColumn[] = [
    {
      title: '采购公告id',
      key: 'proclamationId',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '附件url',
      key: 'attachmentUrl',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '附件名',
      key: 'attachmentName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


// 高级查询数据
export const superQuerySchema = {
  infoId: {title: '外部采购信息id',order: 0,view: 'number', type: 'number',},
  title: {title: '公告标题',order: 1,view: 'text', type: 'string',},
  type: {title: '公告类型',order: 2,view: 'text', type: 'string',},
  region: {title: '区域',order: 3,view: 'text', type: 'string',},
  purchaser: {title: '采购人',order: 4,view: 'text', type: 'string',},
  publishTime: {title: '发布时间',order: 5,view: 'datetime', type: 'string',},
  publishOrgin: {title: '发布机构',order: 6,view: 'text', type: 'string',},
  //子表高级查询
  bidProclamationAttachment: {
    title: '采购公告附件表',
    view: 'table',
    fields: {
        proclamationId: {title: '采购公告id',order: 0,view: 'number', type: 'number',},
        attachmentUrl: {title: '附件url',order: 1,view: 'text', type: 'string',},
        attachmentName: {title: '附件名',order: 2,view: 'text', type: 'string',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}